1. Field of the Invention
The present invention relates generally to an improved data processing system, and in particular, to a computer implemented method for managing memory space. Still more particularly, the present invention relates to a computer implemented method, system, and computer usable program code for selective memory donation in a virtual real memory environment.
2. Description of the Related Art
Data processing systems can be divided into logical partitions (LPAR). A logical partition is also known as a virtual machine. Each virtual machine operates as a separate data processing system independent of the other logical partitions. Generally, a partition management firmware connects the various virtual machines and provides the network connectivity among them. Hypervisor is an example of such partition management firmware.
A data processing system generally includes a fixed amount of physical or real memory. In partitioning the data processing system, the fixed amount of real memory is also partitioned for use by the various virtual machines. Partition management firmware virtualizes the real memory allocated to the virtual machines. Virtualizing real memory is providing a virtual address space that maps to a data storage area larger than the corresponding data storage area of the real memory. When the virtual machine using the virtualized real memory uses more of the virtualized real memory than the real memory allocated to the virtual machine, the partition management firmware pages some of the contents of the real memory out and pages in the content being used by the virtual machine.
Among other uses, virtualizing real memory allows for improved utilization of physical memory on a machine. Virtualizing real memory also allows for hosting a large number of virtual machines on a single data processing system by over-committing the available physical memory. Virtualizing real memory also facilitates the use of advanced workload management capabilities, such as shifting memory between virtual machines that may be busy at different times of the day.
However, virtualized real memory can impose significant performance penalties on the data processing system. For example, to manage virtualized real memory, the partition management firmware generally maintains its own paging spaces for the virtual machines. A paging space is a data storage area allocated to store pages of data removed temporarily from the real memory. Paging space generally exists on data storage devices that are larger in size but slower in speed as compared to the real memory. Such a data storage is also called secondary storage. A hard disk is an example of a secondary storage where paging space may be allocated.
When real memory is over-committed, the hypervisor has to page in and out virtual machines' real memory to and from paging spaces on secondary storage. This paging process is expensive for several reasons. For example, the partition management firmware may not pick the most suitable pages for paging because the partition management firmware may not be aware of a virtual machine's page usage to the extent the operating system executing inside the virtual machine may be.
Additionally, paging using the partition management firmware can often lead to double paging as described by the following example paging scenario. For example, the hypervisor could page out virtual machine memory pages that are being used to cache mundane data, such as file data, in the virtual machine. When the operating system inside the virtual machines needs to flush out cached file pages to make room for comparatively more important data in the virtual machine, the operating system causes the hypervisor to page in the cached file pages, bringing them into memory from the hypervisor paging space. The operating system may then flush the file pages out of memory onto disks containing the file systems. Thus, the partition management firmware will have paged in a page only to page it back out.
To combat these types of problems associated with virtualized real memory, some virtual machine environments use memory donation techniques. Memory donation is also known as ballooning. Memory donation or ballooning involves having a process of the operating system isolate unused or unimportant memory pages and donate it to the partition management firmware. When the physical memory is over-committed, the partition management firmware requests the virtual machines to donate memory to the partition management firmware. An operating system of a virtual machine pages out the unused or unimportant pages to the operating system's own paging space and gives the empty pages to the partition management firmware. Thus, the partition management firmware knows these donated pages are empty and does not have to page any data out of them.
Presently used memory donation techniques have shortcomings as well. Some of the disadvantages of the current memory donation techniques are that current memory donation techniques are resource intensive and result in undesirable structure of the virtual machines for portability. Therefore, an improved system, method, and product for selective memory donation in a virtual real memory environment will be desirable.